package com.example.mobiletest.data

import android.content.Context
import com.example.mobiletest.model.BookingData
import kotlinx.coroutines.delay
import kotlinx.serialization.json.Json

private const val FILE_NAME = "booking.json"

class BookingService(private val context: Context) {
    suspend fun fetchBookingData(): BookingData {
        delay(1000)
        val jsonString = context.assets.open(FILE_NAME)
            .bufferedReader()
            .use { it.readText() }
        return Json.decodeFromString(jsonString)
    }
}